package com.example.movie.common.request

import com.example.movie.common.entity.Order
import com.example.movie.common.model.BaseResponse
import com.example.movie.data.movie.model.bean.ApproveBean
import com.example.movie.data.movie.model.vo.ForumVo
import com.example.movie.data.movie.model.vo.SearchVo
import com.example.movie.data.user.login.model.LoggedInUser
import com.example.movie.ui.video.bean.VideoVo
import com.example.movie.utils.VideoBean
import okhttp3.MultipartBody
import retrofit2.Call
import retrofit2.http.*


interface UserService : AbstractService {

    @FormUrlEncoded
    @POST("login")
    fun login(
        @Field("mobile") username: String,
        @Field("password") password: String
    ): Call<BaseResponse<LoggedInUser>>

    @FormUrlEncoded
    @POST("register")
    fun register(
        @Field("mobile") username: String,
        @Field("password") password: String
    ): Call<BaseResponse<Any>>

    @PUT("logout")
    fun logout(): Call<BaseResponse<Any>>

    @POST("addOrder")
    @FormUrlEncoded
    fun addOrder(
        @Field("seatIds") seatIds: String,
        @Field("planId") planId: Int
    ): Call<BaseResponse<Any>>

    @GET("myOrder")
    fun myOrder(): Call<BaseResponse<List<Order>>>

    @GET("myInfo")
    fun myInfo(): Call<BaseResponse<LoggedInUser>>

    @Multipart
    @PUT("user/update")
    fun updateUser(
        @Part("user") user: LoggedInUser,
        @Part file: MultipartBody.Part?
    ): Call<BaseResponse<Any>>

    @GET("myMovieList")
    fun myMovieList(@Query("type") type: Int): Call<BaseResponse<List<SearchVo>>>

    @GET("video")
    fun loadVideoData():Call<BaseResponse<List<VideoVo>>>

    @PUT("video/like")
    @FormUrlEncoded
    fun like(@Field("vid") vid: Long): Call<BaseResponse<Any>>

    @GET("video/pageForum")
    fun loadForumPage(
        @Query("vid") vid: Long,
        @Query("page") page: Int,
        @Query("size") size: Int): Call<BaseResponse<List<ForumVo>>>

    @PUT("video/comment/approve")
    @FormUrlEncoded
    fun approve(@Field("forumId") forumId: Int): Call<BaseResponse<ApproveBean>>

    @GET("video/replies")
    fun loadReplies(
        @Query("pid") pid: Long,
        @Query("page") page: Int,
        @Query("size") size: Int
    ): Call<BaseResponse<List<ForumVo>>>

    @POST("video/forum/save")
    @FormUrlEncoded
    fun addForum(@Field("vid") vid: Long,
                 @Field("remark") content: String,
                 @Field("pid") pid: Int,
                 @Field("toId") toId: String?
    ): Call<BaseResponse<Int>>


    @GET("video/love")
    fun loadMyLikeMovieVideoList(): Call<BaseResponse<List<VideoBean>>>

}